﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Log = Logger.Debug;
using Debug = Logger.Debug;
using Xiaowei.Settings;
using System.Threading;
using Windows.ApplicationModel.ConversationalAgent;

namespace Xiaowei.Services
{
    public class MVAWakeUpService
    {
        private MVAWakeUpService()
        {

        }
        private static readonly Lazy<MVAWakeUpService> LazyInstance = new Lazy<MVAWakeUpService>(() =>
        {
            return new MVAWakeUpService();
        }, LazyThreadSafetyMode.ExecutionAndPublication);

        public static MVAWakeUpService Instance { get { return LazyInstance.Value; } }
        public event Action WakeupConfirmed;
        public event Action WakeupRejected;

        public void WakeupConfirmedAction() {
            WakeupConfirmed?.Invoke();
        }

        public async void Init()
        {
            var a=await AppServiceManager.Instance.SendMessage(new Windows.Foundation.Collections.ValueSet() {
                    { "Request","MVAInit" }
                });
        }

        public async void RequestAgentStateChangeAsync(ConversationalAgentState state)
        {
            await AppServiceManager.Instance.SendMessage(new Windows.Foundation.Collections.ValueSet() {
                    { "Request","MvaAgentStateChange" }
                });
        }
        public async void SetEnableStageKws(bool firstStage, bool secondStage)
        {
            await AppServiceManager.Instance.SendMessage(new Windows.Foundation.Collections.ValueSet() {
                    { "Request","MvaStageChange" },
                    { "FirstStage",firstStage},
                    {"SecondStage",secondStage }
                });
        }
    }

}
